package com.gupt.weekly.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;

/**
 * @author linzizun
 * @version 1.0
 * @date 2021/03/09 16:46
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "人员信息")
@TableName(value = "tb_user")
public class User {
    @ApiModelProperty(value = "主键非空", example = "创建新用户不要传此字段，会自动生成")
    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    @NotBlank(message = "用户名不能为空")
    @ApiModelProperty(value = "账号，非空唯一", example = "1234")
    private String username;

    @NotBlank(message = "密码不能为空")
    @ApiModelProperty(value = "密码，非空", example = "12341234")
    private String password;

    @NotBlank(message = "姓名不能为空")
    @ApiModelProperty(value = "姓名", example = "周杰伦")
    private String name;

    @Max(value = 1, message = "数据不符合规格（0 女，1 男）")
    @Min(value = 0, message = "数据不符合规格（0 女，1 男）")
    @ApiModelProperty(value = "性别：0 女，1 男", example = "0")
    private Integer sex;

    @ApiModelProperty(value = "联系方式", example = "13866668888")
    private String phone;

    @Min(value = 1, message = "年龄不能小于1")
    @Max(value = 100, message = "年龄过大")
    @ApiModelProperty(value = "年龄", example = "22")
    private Integer age;
}
